﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Hjp.FrameWork.Common;
using System.IO;
using Wjtour.Common;
using CuteWebUI;

namespace Wjtour.Web.Admin.fun
{
    public partial class upload2 : BasePage
    {
        protected Uploader Uploader1;
        protected string tag;

        protected void Page_Load(object sender, EventArgs e)
        {
            Uploader1.FileUploaded += new UploaderEventHandler(Uploader1_FileUploaded);
            tag = Request["tag"];
        }

        protected void Uploader1_FileUploaded(object sender, UploaderEventArgs args)
        {
            string temp = args.GetTempFilePath();
            File.Copy(temp, temp.Replace(".resx", ""), true);
            File.Delete(temp);

            temp = temp.Replace(".resx", "");
            //string uploadDir = Path.GetDirectoryName(temp);
            string ext = Path.GetExtension(temp);
            string imgpath = string.Empty;
            string fileDir = ((BasePage)this.Page).GetUploadDirectory("~/uploads", tag, out imgpath);
            File.Copy(temp, fileDir + "\\" + GetFileName("time") + ext, true);
            File.Delete(temp);
        }
    }
}